<template>
	<view>
	    <view class="searchdv">
	        <view class="navlist">
	            <view class="pagetitle">待签收列表</view>
	            <view class="liava" v-for="item in datalist"  >
	                <view class="nadtitle">
	                  <image src="https://ayh.wissun.net/static/ayh/jxsicon.png" class="jxsicon" mode="widthFix"/>
	                  <view class="paddingleft">上级编号：{{item.jxs_code}}</view>
	                </view>
	                <view class="litems">
	                    <text>发货单号：</text>
	                    <text>{{item.deliveryorderno}}</text>
	                </view>
	                <view class="litems">
	                    <text>发货日期：</text>
	                    <text>{{item.outdate}}</text>
	                </view>
	                <view class="litems" v-if="item.boxcode">
	                    <text>入库数量(箱数)：</text>
	                    <text>{{item.boxcode}} 箱</text>
	                </view>
	                <view class="litems" v-if="item.sncode">
	                    <text>入库数量（罐数）：</text>
	                    <text>{{item.sncode}} 罐</text>
	                </view>
	                <view v-for="it in item.box_detail" 
	                 style="border-top: 1px solid #eee;padding-bottom: 5px;">
	                    <view class="litems" v-if="it.productcd">
	                      <text>产品料号：</text>
	                      <text>{{it.productcd}}</text>
	                    </view>
	                    <view class="litems" v-if="it.product_name">
	                      <text>产品名称：</text>
	                      <text>{{it.product_name}}</text>
	                    </view>
	                    <view class="litems" v-if="it.norm">
	                      <text>产品规格：</text>
	                      <text>{{it.norm}}</text>
	                    </view>
	                    <view class="litems" v-if="it.batch">
	                      <text>产品批次：</text>
	                      <text>{{it.batch}}</text>
	                    </view>
	                    <view class="litems" v-if="it.count">
	                      <text>产品数量：</text>
	                      <text>{{it.count}}  罐</text>
	                    </view>
	                </view>
	                <view class="qrshbtn" @click="querenshouhuo(item)"  v-if="role == 4">确认收货</view>
					<view class="qrshbtn" @click="querenshouhuo2(item)"  v-if="role != 4">确认收货</view>
	            </view>
	        </view>
	        <view class="nodata" v-if="loading">
	            <view>请求中...</view>
	        </view>
	        <view class="nodata" v-if="datalist.length == 0 && !loading">
	            <view>暂无数据</view>
	        </view>
	    </view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
			  datalist:[],
			  role:0,
			  loading:false
			}
		},
		 onShow() {
		  this.role=uni.getStorageSync('fahuo_username').role
		  this.getdata()
		},
		methods: {
			getdata(){
			  var data={}
			  var that=this
			  that.loading=true;
			  data.jxs_code=uni.getStorageSync('fahuo_username').user_code
			  this.request('/api/duoqudao/jxsnoqianshou', data,"post").then(ret => {
				  that.datalist=ret.data
				  that.loading=false
			  })
			},
			//确认收货
			querenshouhuo(item){
			  var deliveryorderno=item.order_no
			   uni.navigateTo({
				 url: '/pages/main/duojifahuo/scanqianshou?order_no='+deliveryorderno,
			   })
			},
			querenshouhuo2(item){
				var data={}
				var that=this;
				data.order_no=item.order_no
				data.jxs_code=uni.getStorageSync('fahuo_username').user_code
				data.system_user=uni.getStorageSync('fahuo_username').id
				// data.latitude=that.latitude
				// data.longitude=that.longitude
				// data.city=that.city
				// data.province=that.province
				// data.nation=that.nation
				this.request('/api/duoqudao/jxs_shouhuo_order', data,"post").then(ret => {
					uni.showModal({
						title: '温馨提示',
						content:ret.message,
						showCancel:false,
						success:function(){ that.getdata(); }
					})
				})
			}
		}
	}
</script>

<style>
.inppd{
  height: 40px;
  line-height: 40px;
  border:  1px solid #eee;
  font-size: 14px;
  border-radius: 20px 0px 0px 20px;
  padding-left: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
}
.paddingleft{
  padding-left: 5px;
}
.nodata{
  text-align: center;
  padding: 40px 0px;
  font-size: 14px;
  color: #999;
}
.searchdv{
  width: 90%;
  margin: 0px auto;
}
.searchdvaaa{
  display: flex;
  margin-top: 24px;
  height: 40px;
  line-height: 40px;
}
.searchbt{
  width: 80px;
  text-align: center;
  background: #fff;
  border-radius: 0px 40px 40px 0px;
  margin-top: 1px;
  height: 40px;
}
.navlist{
  margin-top: 10px;
}
page{
  background-color: #eee;
}
.liava{
  width:calc(100% - 20px);
  margin: 10px auto;
  font-size: 14px;
  border-bottom: 1px solid #eee;
  background: #fff;
  padding: 0px 10px;
  border-radius: 5px;
}
.searchdva{

}
page{
  background-color: #eee;
}
.nadtitle{
  height: 35px;
  line-height: 35px;
  border-bottom: 1px solid #eee;
  padding-left: 5px;
  background: #fff;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 10px;
  display: flex;
  position: relative;
  left: -10px;
}
.jxsicon{
  width: 20px;
  position: relative;
  top: 8px;
}
.litems{
  line-height: 27px;
}
.litems text:nth-child(1){
  font-size: 14px;
  color: #8e8e8e;
}
.litems text:nth-child(2){
  font-size: 14px;
  font-weight: 400;
}
.qrshbtn{
  text-align: center;
  width: calc(100% - 10px);
  margin: 10px auto;
  height: 40px;
  line-height: 40px;
  background-color: #1B764A;
  color: #fff;
  border-radius: 5px;
}
</style>
